package com.silence.thread.happy;

import java.util.concurrent.atomic.AtomicInteger;

public class MyRunnable_happy implements Runnable {
    private int number; // 记录浏览人次
    // 整数修改的乐观锁：原子类实现
    private AtomicInteger count = new AtomicInteger();

    @Override
    public void run() {
        for (int i = 1; i <= 100; i++) {
            System.out.println(Thread.currentThread().getName() +
                    " count --->" + count.incrementAndGet());
        }
    }
}
